﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using c测试;
using System.Threading.Tasks;
using System.Threading;
using System.Security.Cryptography;

namespace rwa
{
    public class er
    {
        const int r = 34;

        public int?[] A = new int?[r];//定义数组A

        public static string ewadawd;

        int i;

        public void dwae()
        {

            for (i = 0; i < r; i++)
            {
                try
                {
                    Console.WriteLine($"请输入第{i}个整数：", i + 1);
                    ewadawd = Console.ReadLine();
                    if (ewadawd != " ")
                    {
                        A[i] = int.Parse(ewadawd);
                    }
                    else if (ewadawd == " ")
                    {
                        A[i] = null;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("输入有误，请重新输入！");
                    i--;
                }
            }
            Console.WriteLine("输入完成！,回车");

            Console.ReadKey();
            int re;
            for (re = 0; re < r - 1; re++) //排序
            {
                for (int j = re ; j < r; j++)//从第re个元素开始，与后面的元素比较，如果小于后面的元素，则交换
                {
                    if (A[re] > A[j])
                    {
                        int? temp = A[re];
                        A[re] = A[j];
                        A[j] = temp;
                    }
                }
            }
            Console.WriteLine("排序结果：");
            for (int k = 0; k < r; k++)
            {
                if (A[k] != null)
                {
                    Console.Write(A[k] + " ");
                }
                else
                {

                }
            }
            Console.WriteLine();
            Console.ReadKey();
        }
    }
}

